package com.wangijun.yuan.admin.base;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;

import java.util.Objects;

@Getter
@Setter
@Schema(description = "分页参数")
public class PageParam<T> {
    @Schema(description = "页码")
    private Integer current;
    @Schema(description = "一页几条数据")
    private Integer size;

    /**
     * 功能描述: 获取分页对象
     *
     * @author wlf 2024/8/20 10:03
     */
    public Page<T> page() {
        return new Page<>(
                Objects.requireNonNullElse(current, 1),
                Objects.requireNonNullElse(size, 10));
    }
}
